 <style>     
 @import './../css/goodsFoot.css';
</style>
<template>
  <div>
    <!-- 底部静止的区域 -->
    <div class="static_area">
      <!-- 下面这句话在未来东方首页的301行，未找到type属性，所以问题暂时搁置 -->
      <!-- <?php $cart_type = $goodsAttr['type'] != 'storesales' ? 1 : 2; ?> -->
      <!-- 底部收藏按钮，悬浮 -->
      <!-- 判断是否有库存(有库存的情况) -->
      <!-- <div class="echlitinaWapFloopy" v-if='data && data.stockNum && data.stockNum !=null'> -->
                                                                    <!-- 如果有值库存就正常默认的类，没有库存就加上disabled这个类 -->
      <div v-if='data' v-bind:class="{'echlitinaWapFloopy':true,disabled: !data.stockNum}">
        <p class='tip'>已售罄</p>
        <div style="background-color: #fff;" class="flex-box mean">
          <div class="goods_bottom_btn">
            <p class='homePage'>
              <i>首页</i>
              <span><icon class="homePage_icon" name="homePage" scale="10"></icon></span>
            </p>
          </div>
        </div>
        <!-- 该盒子被隐藏 -->
        <div style="display:none;" class="goods_bottom_btn goods_collect">
          <i class="echlitinaWapFloopyLeft bgwap-iconfont">&#xe652;</i>
          <i class="split_line"></i>
          <p>收藏</p>
        </div>
        <div class="goods_bottom_btn mean">
          <a href="javascript:;" class="icon_right">
            <label id="cart_num"></label>
          </a>
          <p class='shoppingCart'>
            <span><icon class="shoppingCart_icon" name="shoppingCart" scale="10"></icon></span>
            <i>购物车</i>
          </p>
        </div>
        <div class="goods_add_cart_btn mean" if='data && data.salesType'>
          <p><a v-if='data.salesType!="5"' href="javascript:;" class="echlitinaWapFloopyRight">加入购物车</a></p>
        </div>
        <!-- 如果date.stockNum有值，就执行里面的代码，如果没有值，就输出已卖完 -->
        <div style="background:#e72e35" v-bind:class='{"mean":true,"buy_now":true,disabled:!data.stockNum}'>
          <p><span v-on:click='onMethod(data)' class="buy_now_btn">立即购买</span></p>
        </div>
      </div> 
    </div>
  </div>
</template>
<script>
  import {TransferDom, Popup, Group, Cell ,XHeader, XInput, XButton, Box, Sticky, TabItem, Tab, XImg } from 'vux'
  export default {
  	name: 'goodsFoot', 
    components: {
      XImg,
      TransferDom,
      Popup,
      Group,
      Cell,
      XHeader,
      XInput,
      XButton,
      Box,
      Sticky,
      TabItem,
      Tab  
    },
    directives: {
      TransferDom,
    },
    data () {
      return {
          isActive: true,
          //弹窗规格的初始值  
          popActiveGuiGe: null,
          //弹窗里颜色的初始值
          popActiveColor: null,
          selected: true,
          show: false,
          info: "",
          data: {},
          secondData: {},
      }
    },
    methods: {
      // 组件通信子组件调用父组件的函数
      onMethod() {
        //如果有库存，才会触发弹窗效果
        if(this.data.stockNum) {
          // emit 触发父元素的函数
          this.$emit("componentCommunication"); 
        }
      },
    },
    mounted: function() {
      //子组件中的ajax通过组件通信的方式引用
      this.data = this.$attrs.getProductInfoUrlAjax;
    },
    beforeUpdate() {
      //子组件中的ajax通过组件通信的方式引用
      this.data = this.$attrs.getProductInfoUrlAjax
    }
  }
</script>





